package demo13;

/**
 * Created by Administrator on 2017/5/24.
 */
public class StartOrEnd {
    public static void main(String[] args) {
        String num1="22045612";
        String num2="21304578";
        boolean b=num1.startsWith("22");
        boolean b2=num1.endsWith("78");
        boolean b3=num2.startsWith("22");
        boolean b4=num2.endsWith("78");
        System.out.println("字符串num1是以'22'开始的吗？"+b);
        System.out.println("字符串num1是以'78'结束的吗？"+b2);
        System.out.println("字符串num2是以'22'开始的吗？"+b3);
        System.out.println("字符串num2是以'78'结束的吗？"+b4);
        System.out.println("------------------");
        String tom = new String("I am a student");
        String jerry = new String("I am a student");
        boolean b5=(tom ==jerry);
        System.out.println(b5);
        System.out.println("------------------");
        String s1=new String("abc");
        String s2=new String("ABC");
        String s3=new String("abc");
        boolean b6=s1.equals(s2);
        boolean b7=s1.equalsIgnoreCase(s2);
        System.out.println(s1+"  equals  "+s2+": "+b6);
        System.out.println(s1+"  equalsIgnore  "+s2+": "+b7);
    }
}
